<%@ page language="java" import="java.util.*,com.hs.core.db.*,com.hs.core.utils.*,java.net.*,com.hs.app.action.search.*" pageEncoding="utf-8"%>
<%
DBMgr inst = DBMgr.getDbUtilInst(request.getSession().getServletContext());

StringBuffer onesql = new StringBuffer(" select *　from (select * from (select years,count(*) as count from (select substr(YEARSTR,0,4) as years,id　from CDC_BIBLIO where   YEARSTR is not null ) group by years ) order by count desc) order by years desc ");
StringBuffer twosql = new StringBuffer(" select * from (select * from (select PERIODICALNAME,count(*) as countnum　from CDC_BIBLIO where  PERIODICALNAME is not null  group by PERIODICALNAME) order by countnum desc) where rownum <=10");
List list1 = inst.queryList(onesql.toString(), null);
List list2 = inst.queryList(twosql.toString(), null); 
//List list3 = inst.queryList(threesql.toString(), null);
StringBuffer year1str = new StringBuffer();
StringBuffer data1str = new StringBuffer();
StringBuffer year2str = new StringBuffer();
StringBuffer data2str = new StringBuffer(); 
Map yearmap = new HashMap();
Integer curryear = new Integer(TimeUtil.getCurrentYear());
// for(int j =0;j<6;j++){
//    int temp = (curryear - j) ;
//     yearmap.put(temp+"",temp+"");
// }
int count = 1;
for(int i =0;i<list1.size();i++){
	Map m1 = (Map)list1.get(i);
	String years = (String)m1.get("years");
	System.out.println("years:" + years);
	String countstr =  m1.get("count")+""; 
	//if(null == yearmap.get(years)){
	//	continue;
	//}
	if(count <=10 ){
		if(BigNumCal.isNumeric(years)&&years.length() == 4){
			year1str.append("'").append(years).append("',");
			data1str.append(countstr).append(",");
			count++; 
		}else{
			continue;
		} 
	}else{
		break;
	}
}
	int count1 =1;
	for(int j =0;j<list2.size();j++){
	Map m2 = (Map)list2.get(j);
	String years = (String)m2.get("PERIODICALNAME");
	String countstr =  m2.get("countnum")+"";
	//if(null == yearmap.get(years)){
	//	continue;
	//}
	
	year2str.append("'").append(years).append("',");
	data2str.append(countstr).append(",");
	
}
 
String year1strend = year1str.length()==0?"":year1str.substring(0,year1str.length()-1).toString();
String year2strend = year2str.length()==0?"":year2str.substring(0,year2str.length()-1).toString(); 
String data1strend = data1str.length()==0?"":data1str.substring(0,data1str.length()-1).toString();
String data2strend = data2str.length()==0?"":data2str.substring(0,data2str.length()-1).toString(); 

  
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head> 
<%@ include file="../../include.jsp"%> 
<script src='<%=basePath%>thirtpart/jquery/jquery.blockUI.js'></script> 
<script src='<%=basePath%>app/js/hs.search.js'></script> 
<script language="javascript" type="text/javascript" src="<%=path %>/thirtpart/highchart302/highcharts.js"></script>
<script language="javascript" type="text/javascript" src="<%=path %>/thirtpart/highchart302/modules/exporting.js"></script>
<style>.tac{text-align:center}</style>
<script type="text/javascript">
  function changgeUrl(url){ 
	 	dataform.action=url;
	 	dataform.submit();
  } 
</script>
</head>
<body class="bodyBg">
<dl class="system_intro">
    <dt><!--系统简介--></dt>
    <dd>  
    	<p>随着生活水平的提高和生活节奏的加快，人类的心血管疾病的发病率在不断上升，有资料统计，全球每年死于心血管疾病的人数为1450万，因此寻求防治心血管病的手段和方法是21世纪生命科学研究的重大课题。 建国以来，中医对心血管病的防治研究作了大量的工作，在临床取得了重大成功。包括创立了冠心Ⅱ号方、复方丹参片、复方丹参滴丸、参麦注射液、丹红注射液、芪参益气等有效成药，至今在临床上广泛应用。同时在基础理论研究方面，血脂与痰浊相关性的研究、瘀血证实质的研究、心气虚证与心功能低下关系等的研究也取得了可喜的成绩。 因此，对治疗心血管疾病的方剂、中药、组分的化学、活性、安全、临床信息的研究具有重要作用和实际意义。本系统是针对治疗心血管疾病的方剂、中药和组分的信息检索统计系统，包含了数据预处理、数据加工、术语标准信息检索统计、分类数据检索、数据挖掘等多个功能模块。</p>
    </dd>
</dl>
<dl class="chart">
	<dt><img src="<%=imagePath %>icon_chart1.gif"/>近十年期刊文献数量统计</dt>
    <dd>
    <div id="container1" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
	</dd>
</dl>
<dl class="chart pull-right">
	<dt><img src="<%=imagePath %>icon_chart2.gif"/>文献来源数量对比图</dt>
    <dd>
    <div id="container2" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
	</dd>
</dl>
</body>
</html> 
<script type="text/javascript">
$(function () {
        $('#container1').highcharts({
            chart: {
                type: 'line'
            },
            title: {
                text: ''
            }, 
            xAxis: {
                categories: [<%=year1strend%>]
            },
            yAxis: {
                title: {
                    text: '文献数量'
                }
            },
            tooltip: {
                enabled: false,
                formatter: function() {
                    return '<b>'+ this.series.name +'</b><br/>'+
                        this.x +': '+ this.y +'°C';
                }
            },
            plotOptions: {
                line: {
                    dataLabels: {
                        enabled: true
                    },
                    enableMouseTracking: false
                }
            },
            series: [{
                name: '历年文献数量趋势图',
                color: '#EE3B3B',
                borderColor:  '#EE3B3B',
                data: [<%=data1strend%>]
            }]
        });
        
        $('#container2').highcharts({
        	chart: {
                type: 'column',
                zoomType: 'xy'   
            },
            title: {
                text: ''
            }, 
            xAxis: {
                categories: [<%=year2strend%>],
                labels: {                 
                	rotation: -45,  //逆时针旋转45°，标签名称太长。               
                	align: 'right'  //设置右对齐            
                } 
            },
            yAxis: {
                min: 0,
                title: {
                    text: '文献数量 (篇)'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                    '<td style="padding:0"><b>{point.y:.1f} </b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: '文献期刊来源分布图',
                color: '#71C671',
                borderColor:  '#71C671',
                borderRadius:'2', 
                data: [<%=data1strend%>]
    
            }]
        });

    });
    
 
</script>


